package com.base.glide;

import android.content.Context;

import androidx.annotation.NonNull;

import com.base.util.MemoryUtil;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public final class GlideAppModule extends AppGlideModule {
    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        //设置缓存目录(都可以自定义的)
        String dirCache = MemoryUtil.DIR_CACHE;

        //设置缓存的大小为100M
        int cacheSize = 10 * 1024 * 1024;
        builder.setDiskCache(new DiskLruCacheFactory(dirCache, cacheSize));
    }

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}